-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added object size in show most common type #60
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
This is definitely an interesting idea, but I dislike how it makes backwards-incompatible changes to the structure of the return value. Perhaps a second function, typestats_with_sizes() would be better?
Also, I will not merge it without documentation changes.
@@ -273,7 +274,8 @@ def show_most_common_types( | |||
filter=filter) | |||
width = max(len(name) for name, count in stats) | |||
for name, count in stats: | |||
file.write('%-*s %i\n' % (width, name, count)) | |||
file.write('%-*s - %i - %i - %i\n' % | |||
(width, name, count[0], count[1], count[0]*count[1])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assumes all the objects of the same type are of the same size, which is not necessarily true.
On my laptop sys.getsizeof("a") == 50
, but sys.getsizeof("a"*1000) == 1049
.
This commit will give object size too in the output